
using System.Web.Http;
using System.Web.Mvc;
using CNav.Business;
using CNav.Common;
using log4net.Repository.Hierarchy;
using Microsoft.Practices.Unity;
using Unity.Mvc4;

namespace CNav.App_Start
{
    public static class Bootstrapper
    {
        public static void Initialise(IUnityContainer container)
        {
            var serviceContainer = new ServiceContainer(container);
            container.RegisterInstance<IServiceContainer>(serviceContainer);
            container.RegisterType(typeof (ILoggerFactory));
           
            // MVC 4
            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
            // Web api
            GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
        }
    }
}